home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 242_01 / a51.doc < prev    next >
Text File  |  1989-01-11  |  46KB  |  1,233 lines

  1. /*
  2.     HEADER:        CUG242;
  3.     TITLE:        8051 Cross-Assembler (Portable);
  4.     FILENAME:    A51.DOC;
  5.     VERSION:    0.4;
  6.     DATE:        11/09/1988;
  7.     SEE-ALSO:    A51.H;
  8.     AUTHORS:    William C. Colley III;
  9. */
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.                          8051 Cross-Assembler (Portable)
  25.  
  26.  
  27.                                    Version 0.4
  28.  
  29.  
  30.                  Copyright (c) 1985,1987 William C. Colley, III
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.                             The manual such as it is.
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.         Legal Note:    This package may be used for any commercial or 
  50.                        non-commercial purpose.  It may be copied and 
  51.                        distributed freely provided that any fee charged 
  52.                        by the distributor of the copy does not exceed the 
  53.                        sum of:  1) the cost of the media the copy is 
  54.                        written on,  2) any required costs of shipping the 
  55.                        copy, and  3) a nominal handling fee.  Any other 
  56.                        distribution requires the written permission of 
  57.                        the author.  Also, the author's copyright notices 
  58.                        shall not be removed from the program source, the 
  59.                        program object, or the program documentation.
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.                                 Table of Contents
  75.  
  76.         1.0  How to Use the Cross-Assembler Package ..................  3
  77.         2.0  Format of Cross-Assembler Source Lines ..................  4
  78.              2.1  Labels .............................................  5
  79.              2.2  Numeric Constants ..................................  6
  80.              2.3  String Constants ...................................  6
  81.              2.4  Expressions ........................................  6
  82.              2.5  Bit Expressions ....................................  7
  83.         3.0  Machine Opcodes .........................................  8
  84.              3.1  Opcodes -- No Arguments ............................  8
  85.              3.2  Opcodes -- One Argument ............................  8
  86.              3.3  Opcodes -- Two Arguments in Order ..................  9
  87.              3.4  Opcodes -- Two Arguments in Either Order ...........  9
  88.              3.5  Opcodes -- Three Arguments in Order ................  9
  89.              3.6  Opcodes -- Relative Branches .......................  9
  90.              3.7  Opcodes -- Absolute Branches .......................  9
  91.              3.8  Opcodes -- Long Branches ........................... 10
  92.              3.9  Opcodes -- MOV ..................................... 10
  93.         4.0  Pseudo Opcodes .......................................... 10
  94.              4.1  Pseudo-ops -- BIT .................................. 10
  95.              4.2  Pseudo-ops -- DB ................................... 10
  96.              4.3  Pseudo-ops -- DS ................................... 11
  97.              4.4  Pseudo-ops -- DW ................................... 11
  98.              4.5  Pseudo-ops -- END .................................. 11
  99.              4.6  Pseudo-ops -- EQU .................................. 12
  100.              4.7  Pseudo-ops -- IF, ELSE, ENDIF ...................... 12
  101.              4.8  Pseudo-ops -- INCL ................................. 13
  102.              4.9  Pseudo-ops -- ORG .................................. 13
  103.              4.10 Pseudo-ops -- PAGE ................................. 13
  104.              4.11 Pseudo-ops -- REG .................................. 14
  105.              4.12 Pseudo-ops -- SET .................................. 14
  106.              4.13 Pseudo-ops -- TITL ................................. 14
  107.         5.0  Assembly Errors ......................................... 14
  108.              5.1  Error * -- Missing Statement ....................... 15
  109.              5.2  Error ( -- Parenthesis Imbalance ................... 15
  110.              5.3  Error " -- Missing Quotation Mark .................. 15
  111.              5.4  Error B -- Branch Target Out of Bounds ............. 15
  112.              5.5  Error D -- Illegal Digit ........................... 15
  113.              5.6  Error E -- Illegal Expression ...................... 16
  114.              5.7  Error I -- IF-ENDIF Imbalance ...................... 16
  115.              5.8  Error L -- Illegal Label ........................... 16
  116.              5.9  Error M -- Multiply Defined Label .................. 16
  117.              5.10 Error O -- Illegal Opcode .......................... 16
  118.              5.11 Error P -- Phasing Error ........................... 17
  119.              5.12 Error S -- Illegal Syntax .......................... 17
  120.              5.13 Error T -- Too Many Arguments ...................... 17
  121.              5.14 Error U -- Undefined Label ......................... 17
  122.              5.15 Error V -- Illegal Value ........................... 17
  123.         6.0  Warning Messages ........................................ 17
  124.              6.1  Warning -- Illegal Option Ignored .................. 18
  125.              6.2  Warning -- -l Option Ignored -- No File Name ....... 18
  126.              6.3  Warning -- -o Option Ignored -- No File Name ....... 18
  127.              6.4  Warning -- Extra Source File Ignored ............... 18
  128.              6.5  Warning -- Extra Listing File Ignored .............. 18
  129.  
  130.  
  131.                                         1
  132.  
  133.  
  134.  
  135.              6.6  Warning -- Extra Object File Ignored ............... 18
  136.         7.0  Fatal Error Messages .................................... 18
  137.              7.1  Fatal Error -- No Source File Specified ............ 18
  138.              7.2  Fatal Error -- Source File Did Not Open ............ 18
  139.              7.3  Fatal Error -- Listing File Did Not Open ........... 19
  140.              7.4  Fatal Error -- Object File Did Not Open ............ 19
  141.              7.5  Fatal Error -- Error Reading Source File ........... 19
  142.              7.6  Fatal Error -- Disk or Directory Full .............. 19
  143.              7.7  Fatal Error -- File Stack Overflow ................. 19
  144.              7.8  Fatal Error -- If Stack Overflow ................... 19
  145.              7.9  Fatal Error -- Too Many Symbols .................... 19
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.                                         2
  193.  
  194.  
  195.  
  196.         1.0  How to Use the Cross-Assembler Package
  197.  
  198.              First, the question, "What does a cross-assembler do?" needs 
  199.         to be addressed as there is considerable confusion on this point.  
  200.         A cross-assembler is just like any other assembler except that it 
  201.         runs on some CPU other than the one for which it assembles code.  
  202.         For example, this package assembles 8051 source code into 8051
  203.         object code, but it runs on an 8080, a Z-80, an 8088, or whatever 
  204.         other CPU you happen to have a C compiler for.  The reason that 
  205.         cross-assemblers are useful is that you probably already have a 
  206.         CPU with memory, disk drives, a text editor, an operating system, 
  207.         and all sorts of hard-to-build or expensive facilities on hand.  
  208.         A cross-assembler allows you to use these facilites to develop 
  209.         code for an 8051.
  210.  
  211.         This program requires one input file (your 8051 source code) and 
  212.         zero to two output files (the listing and the object).  The input 
  213.         file MUST be specified, or the assembler will bomb on a fatal 
  214.         error.  The listing and object files are optional.  If no listing 
  215.         file is specified, no listing is generated, and if no object file 
  216.         is specified, no object is generated.  If the object file is 
  217.         specified, the object is written to this file in "Intel 
  218.         hexadecimal" format.
  219.  
  220.              The command line for the cross-assembler looks like this:
  221.  
  222.                   A51 source_file { >list_file } { -o object_file }
  223.  
  224.         where the { } indicates that the specified item is optional.
  225.  
  226.              Some examples are in order:
  227.  
  228.              a51 test51.asm                          source:   test51.asm
  229.